import requests


def get_freight_json(product_id, sku_count=1, country='US'):
    headers = {
        'accept': 'application/json, text/plain, */*',
        'accept-encoding': 'gzip, deflate, br',
        'referer': f'https://www.aliexpress.com/item/{product_id}.html',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36'
    }
    url = f'https://www.aliexpress.com/aeglodetailweb/api/logistics/freight?productId={product_id}&count={sku_count}&country={country}&provinceCode=&cityCode=&tradeCurrency=USD&userScene=PC_DETAIL_SHIPPING_PANEL'
    response = requests.get(url, headers=headers, timeout=10)
    return response.text


if __name__ == '__main__':
    print(get_freight_json(4000273287239))
